package com.aydqyy.springbootstart.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.aydqyy.springbootstart.dao.UserDao;
import com.aydqyy.springbootstart.entity.User;
import com.aydqyy.springbootstart.service.UserService;
import org.springframework.stereotype.Service;

import java.sql.SQLException;
import java.sql.Wrapper;

/**
 * (User)表服务实现类
 *
 * @author makejava
 * @since 2025-03-07 14:43:27
 */
@Service("userService")
public class UserServiceImpl extends ServiceImpl<UserDao, User> implements UserService {

    public User getByName(String name)
    {
        LambdaQueryWrapper<User> lambdaWrapper = new LambdaQueryWrapper<>();
        lambdaWrapper.eq(User::getName, name) ;   // 字段通过方法引用指定
        User user  = this.getOne(lambdaWrapper);
       return  user;
    }

}

